<template>
  <view class="viewimg">
    <view>
      <echarts :option="option" style="height: 300*2rpx"></echarts>
      
    </view>
    <!-- <view><echarts :option="optionone" style="height: 400*2rpx"></echarts></view> -->
    <!-- <view><echarts :option="optiontwo" style="height: 400*2rpx;"></echarts></view> -->
  </view>
</template>
 
<script>
import echarts from "@/components/echarts/echarts.vue";
import request from '@/service/request1.js'
export default {
  data() {
    return {
      option: {},
    };
  },
  onLoad() {
    console.log(777777);
  },
  components: {
    echarts,
  },
  mounted() {
    this.logstatrt();
  },

  methods: {
    logstatrt() {
      console.log("初次调用");
	
      this.option = {
        // backgroundColor: "#011246",
        xAxis: {
          type: "category",
          data: [],
        },
        yAxis: {
          type: "value",
        },
        series: [
          {
            data: [],
            type: "bar",
          },
        ],
      };
	  request('/api/workbench/deskmode?modetype=huikuan',{
	  	dateRang: ["2021-09-01", "2021-09-30"],
	  	selectType: ""
	   	},'POST').then(res=>{
	  		console.log(res.data.result.data.barData)
			 res.data.result.data.barData.forEach(e => { 
					this.option.xAxis.data.push(e.label);   //  x轴数据赋值
					this.option.series[0].data.push(e.回款金额)  // y轴数据赋值
					  });
	  	})
    },

  },
};
</script>
<style scoped>
.viewimg {
  height: 100%;
  /* background: #d1e9e9; */
}
</style>